#ifndef GRAPHICSSCENE_H
#define GRAPHICSSCENE_H

#include <QObject>
#include <QGraphicsScene>
#include "ui_MainWindow.h"
#include "Marker.h"

class GraphicsScene: public QGraphicsScene
{
    Q_OBJECT

public:
    GraphicsScene(QObject *parent = 0);
    QList<QGraphicsItem*> listHelper;
    void correspondingItems(QList<QGraphicsItem*> selections);
    void removelastItem();
    int seqNumber;

private:
    void  setZValue(int z);
    void  addMarker(QPointF *xy);
    void  setupMarker(Marker *marker,QPointF *xy);
    void  bringToFront();
    void  sendToBack();

    Marker *marker;
    Marker *selectedMarker() const;

    QAction *sendToBackAction;
    QAction *deleteAction;
    QAction *bringToFrontAction;

    int minZ;
    int maxZ;


signals:
    void markerPos(qreal xpos, qreal ypos);

    void markerPosChanged(qreal xposr, qreal yposr);

    void listchanged();


private slots:

    void on_markerPosPre(qreal xpos, qreal ypos);


protected:
    void mouseDoubleClickEvent( QGraphicsSceneMouseEvent * event );
    void selectionChanged();
};

#endif // GRAPHICSSCENE_H
